// router/index.ts
import { createRouter, createWebHistory } from 'vue-router'
import Layout from '@/layout/Index.vue'
import { menuList } from '@/router/menuList'

const routes = menuList.map(item => ({
  path: item.path,
  component: Layout,
  children: [{
    path: 'index',
    name: item.meta.title,
    component: () => import(`@/views/${item.path.replace('/', '')}.vue`),
    meta: item.meta
  }]
}))

export default createRouter({
  history: createWebHistory(),
  routes
})